package com.lifecyc.waveprogressdemo;

import android.os.Bundle;
import android.widget.SeekBar;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

import com.lifecyc.waveprogressdemo.progressbar.CircleBarView;
import com.lifecyc.waveprogressdemo.progressbar.WaveProgressView;
import com.lifecyc.waveprogressdemo.progressbar.WaveProgressView1;
import com.lifecyc.waveprogressdemo.progressbar.WaveProgressView3;

public class MainActivity extends AppCompatActivity {

    WaveProgressView pb;
    WaveProgressView3 pb1;
    SeekBar seekBar;
    TextView tvInfo;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        pb = findViewById(R.id.pb);
        pb.setBackgroundResource(R.mipmap.icon_progress_empty);
        pb1 = findViewById(R.id.pb1);
        seekBar = findViewById(R.id.seekBar);
        tvInfo = findViewById(R.id.tvInfo);
        pb.setProgressNum(10 * 5);

//        pb.setOnAnimationListener(new WaveProgressView.OnAnimationListener() {
//            @Override
//            public String howToChangeText(float interpolatedTime, float updateNum, float maxNum) {
//                return null;
//            }
//
//            //省略部分代码...
//            @Override
//            public float howToChangeWaveHeight(float percent, float waveHeight) {
//                return (1-percent)*waveHeight;
//            }
//        });
        seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
            @Override
            public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
                pb.setProgressNum(i * 5);
                pb1.setProgressNum(i * 5);
//                pb1.setProgressNum(i, 3000);
                tvInfo.setText(String.valueOf(i));
            }

            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {

            }

            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {

            }
        });
    }
}
